package cn.js.sip.rat.system.service.impl;

import cn.js.sip.rat.system.entity.LogInfoEntity;
import cn.js.sip.rat.system.mapper.LogMapper;
import cn.js.sip.rat.system.page.TableDataInfo;
import cn.js.sip.rat.system.service.LogService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @ClassName: cn.js.sip.rat.system.service.impl
 * @Description: TODO
 * @author: xuxiaoli
 * @Date: 2020-01-02   21:41
 */
@Service("logService")
public class LogServiceImpl extends BaseServiceImpl<LogInfoEntity> implements LogService {

    @Resource
    private LogMapper logMapper;

    @Override
    public void saveLog(String businessCode,String modelCode,String modelName,String content,String operateName){
        LogInfoEntity logInfoEntity = new LogInfoEntity();
        logInfoEntity.setCreateInfo();
        logInfoEntity.setBusinessCode(businessCode);
        logInfoEntity.setContent(content);
        logInfoEntity.setModelCode(modelCode);
        logInfoEntity.setModelName(modelName);
        logInfoEntity.setOperateName(operateName);
        logMapper.insert(logInfoEntity);
    }

    @Override
    public TableDataInfo query(LogInfoEntity operLog) {
        Page page = new Page(1,10);
        Page selectPage = logMapper.selectPage(page, null);
        return super.getDataTable(selectPage);
    }
}
